package com.hongtech.modules.knowledge.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hongtech.common.service.impl.CrudServiceImpl;
import com.hongtech.common.util.BeanCopierUtils;
import com.hongtech.modules.knowledge.mapper.DepartmentMapper;
import com.hongtech.modules.knowledge.dto.DepartmentDTO;
import com.hongtech.modules.knowledge.entity.DepartmentEntity;
import com.hongtech.modules.knowledge.service.DepartmentService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 疾病科室表
 *
 * @author admin 123456789@qq.com
 * @since 1.0.0 2023-09-01
 */
@Service
public class DepartmentServiceImpl extends CrudServiceImpl<DepartmentMapper, DepartmentEntity, DepartmentDTO> implements DepartmentService {

    @Override
    public List<DepartmentDTO> listDepartment() {
        LambdaQueryWrapper<DepartmentEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(DepartmentEntity::getOrderNumber);
        List<DepartmentEntity> list = baseDao.selectList(queryWrapper);
        return BeanCopierUtils.copyPropertiesList(list, DepartmentDTO.class);
    }

}
